const express = require('express');
const noteRouter = require('./routes/noteRouter');
const noteApiRouter = require('./routes/noteApiRouter');
const loginRouter = require('./routes/loginRouter');


const app = express();
//解决跨域
app.use((req, res, next) => {
    res.setHeader("Access-Control-Allow-Origin", "*")
    next()
})
// 配置获取请求体中间件
app.use(express.urlencoded({ extended: false }))
// 配置静态资源文件目录
app.use(express.static(__dirname + '/public'));
// app.set('views',__dirname+'/views');
// app.engine('html', ejs.renderFile);

//登录路由器
app.use(loginRouter)
// 调用页面router
app.use(noteRouter)
// 调用note接口router
app.use(noteApiRouter)

app.listen(80, () => {
    console.log('启动成功');
})

